<script setup lang="ts">
import { ContentDetailWrap } from '@/components/ContentDetailWrap'
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
import { watch, inject, reactive, Ref } from 'vue'
import { Row } from '@/api/franchiser'
const emit = defineEmits(['close', 'get-list'])
const currentRow: Ref<Row> = inject('currentRow') as Ref<Row>

const schema = reactive<DescriptionsSchema[]>([
  {
    field: 'mobile',
    label: '登录账号'
  },
  {
    field: 'user_name',
    label: '账号名称'
  },
  {
    field: 'real_name',
    label: '选择角色'
  }
])
watch(
  () => currentRow.value,
  (currentRow) => {
    if (!currentRow) return
    console.log(currentRow)
  },
  {
    deep: true,
    immediate: true
  }
)
</script>

<template>
  <ContentDetailWrap title="订单详情">
    <div style="margin-top: 40px">
      <Descriptions message="message" :data="currentRow" :schema="schema" />
    </div>
    <template #footer>
      <div class="w-full flex items-center justify-center">
        <BaseButton type="primary" @click="emit('close')">返回</BaseButton>
      </div>
    </template>
  </ContentDetailWrap>
</template>
